home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / prg_casm / snpd9611.zip / STRCHCAT.C < prev    next >
C/C++ Source or Header  |  1996-11-24  |  1KB  |  46 lines

  1. .I 0 2
  2. /* +++Date last modified: 24-Nov-1996 */
  3.  
  4. .I 7 1
  5. **  Returns: Pointer to modified string, or NULL if insufficient space
  6. .D 8 1
  7. .I 12 10
  8. **  The user is granted a free limited license to use this source file
  9. **  to create royalty-free programs, subject to the terms of the
  10. **  license restrictions specified in the LICENSE.MFL file.
  11. **
  12. **  NOTE: The name of this funtion violates ANSI/ISO 9899:1990 sec. 7.1.3,
  13. **        but this violation seems preferable to either violating sec. 7.13.8
  14. **        or coming up with some hideous mixed-case or underscore infested
  15. **        naming. Also, many SNIPPETS str---() functions duplicate existing
  16. **        functions which are supported by various vendors, so the naming
  17. **        violation may be required for portability.
  18. .D 13 1
  19. .I 19 5
  20. #if defined(__cplusplus) && __cplusplus
  21.  extern "C" {
  22. #endif
  23.  
  24. char *strchcat(char *string, int ch, size_t buflen)
  25. .D 20 1
  26. .I 31 4
  27. #if defined(__cplusplus) && __cplusplus
  28.  }
  29. #endif
  30.  
  31. .I 37 6
  32.       char buf1[80] = "This buffer's big enough",
  33.            buf2[] = "This one's not";
  34.       char *ptr;
  35.  
  36.       printf("strchcat(\"%s\", '!') ", buf1);
  37.       ptr = strchcat(buf1, '!', sizeof(buf1));
  38. .D 38 5
  39. .I 47 2
  40.       printf("strchcat(\"%s\", '!') ", buf2);
  41.       ptr = strchcat(buf2, '!', sizeof(buf2));
  42. .D 48 2
  43. .I 56 1
  44. #endif /* TEST */
  45. .D 57 1
  46.